package com.jwx.mycar.utils;

import com.baidu.aip.imageclassify.AipImageClassify;
import org.json.JSONArray;
import org.json.JSONObject;

import java.util.HashMap;

/**
 * @program: mycar
 * @description:
 * @author: jwx
 * @create: 2019-11-17 14:46
 **/
public class Sample {
    //设置APPID/AK/SK
    public static final String APP_ID = "16009781";
    public static final String API_KEY = "vIQ8XGV4UQHStOlI9r38QHP1";
    public static final String SECRET_KEY = "ym7Eu3jyYuFzfEswzfZB7THXUKchXZpu";

    public static void main(String[] args) {
        // 初始化一个AipImageClassify
        AipImageClassify client = new AipImageClassify(APP_ID, API_KEY, SECRET_KEY);

        // 传入可选参数调用接口
        HashMap<String, String> options = new HashMap<String, String>();
        options.put("top_num", "1");
        options.put("baike_num", "5");


        // 参数为本地路径
        String image = "C:\\Users\\ASUS\\Desktop\\1.jpg";
        JSONObject res = client.carDetect(image, options);
        System.out.println(res.toString(2));



    }
}

